Skip to content

Conversation

@TCOTC
Copy link
Contributor

@TCOTC TCOTC commented Aug 18, 2025

  1. 继续修复 Using openTab updateCards option is null #10331
  2. 修复 使用新窗口打开 的闪卡与当前正在复习的闪卡不一致 #14149 01
  3. 增加 在新页签中打开 选项 #14149 02

@TCOTC TCOTC mentioned this pull request Aug 18, 2025
});
async update() {
const cardsData = await fetchCardsData();
await renderCardsAndBindEvents(this.element, this.data, cardsData);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

源代码中没有以下代码,但是调用的函数里面有,没有影响么?

editor = await bindCardEvent({
                        app: options.app,
                        element: this.element,
                        id: this.data.id,
                        title: this.data.title,
                        cardType: this.data.cardType,
                        cardsData,
                    });

                    customObj.editors.push(editor);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是有问题,等我想想怎么改

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不行就分开吧,而且这个函数里面还有个外部的变量。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

基本改完了,等会推上来

@TCOTC
Copy link
Contributor Author

TCOTC commented Sep 8, 2025

可以了,现在不会重复添加事件监听器

});
async update() {
const cardsData = await fetchCardsData();
await renderCardsAndBindEvents(this.element, this.data, cardsData ,undefined, true);
Copy link
Member

@Vanessa219 Vanessa219 Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不太理解为什么一定要这么重构,可以只改业务么?看上去多了 push

Copy link
Contributor Author

@TCOTC TCOTC Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前的 update 方法完全是坏的,修复之后重复的代码太多所以又抽象成一个函数了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renderCardsAndBindEvents 和 fetchCardsData 看上去是一个重构。并且修改了原有代码业务:在原有的 108 行 添加了 customObj.editors.push(editor); 。这个用肉眼看上去并不能修复之前完全坏的 update 方法,可能还会引出更多的问题。

@TCOTC
Copy link
Contributor Author

TCOTC commented Sep 9, 2025

可以了,现在会销毁旧的 editor

@Vanessa219
Copy link
Member

这个问题的重现步骤是?

继续修复 #10331

@TCOTC
Copy link
Contributor Author

TCOTC commented Oct 2, 2025

用示例插件:

async updateCards(options: ICardData) {
    console.log("updateCards:", options);
    return options;
}
video.webm

@Vanessa219 Vanessa219 merged commit b6a9ef2 into siyuan-note:dev Oct 14, 2025
@Vanessa219 Vanessa219 requested a review from Copilot October 14, 2025 01:46
@Vanessa219 Vanessa219 added the Bug label Oct 14, 2025
@Vanessa219 Vanessa219 added this to the 3.3.5 milestone Oct 14, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the spaced repetition interface by refactoring card components and adding new tab functionality. The changes address issues with flash card consistency when opening in new windows and add the ability to open cards in new tabs.

  • Refactored card initialization logic to better handle component state
  • Added "Open in New Tab" option to the card interface menu
  • Fixed data consistency issues when opening cards in new windows

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/src/card/openCard.ts Extracted card initialization logic into separate function and added new tab menu option
app/src/card/newCardTab.ts Refactored card tab model to use new initialization pattern and improved update handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

});
async update() {
const cardsData = await fetchCardsData();
await renderCardsAndBindEvents(this.element, this.data, cardsData ,undefined, true);
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space before comma in function call.

Suggested change
await renderCardsAndBindEvents(this.element, this.data, cardsData ,undefined, true);
await renderCardsAndBindEvents(this.element, this.data, cardsData, undefined, true);

Copilot uses AI. Check for mistakes.
@Vanessa219
Copy link
Member

更新以后点击按钮会如下报错,我重新修改了下。

QQ20251014-102405

Vanessa219 added a commit that referenced this pull request Oct 14, 2025
@TCOTC TCOTC deleted the fix/cards branch October 14, 2025 04:33
@TCOTC
Copy link
Contributor Author

TCOTC commented Oct 14, 2025

@Vanessa219 update 方法 bindCardEvent 会导致重复添加监听器(这是我之前拆分为 initCardComponent 和 bindCardEvent 两个函数的原因)

Vanessa219 added a commit that referenced this pull request Oct 14, 2025
@Vanessa219
Copy link
Member

不添加事件的话会有上面的错误,目前已修复。

leolee9086 pushed a commit to leolee9086/siyuan that referenced this pull request Oct 25, 2025
* Improve spaced repetition interface

fix siyuan-note#10331

* Improve spaced repetition interface

fix siyuan-note#14149

* Improve spaced repetition interface

fix siyuan-note#10331

* Improve spaced repetition interface

fix siyuan-note#10331
leolee9086 pushed a commit to leolee9086/siyuan that referenced this pull request Oct 25, 2025
EightDoor added a commit to EightDoor/siyuan that referenced this pull request Oct 29, 2025
* commit '779c6ede2855aee91f7f54b0b65b7ce3add40c2c': (121 commits)
  🔖 Release v3.3.5
  📝 Update changelogs
  🚨
  🎨 siyuan-note#15627
  Improve spaced repetition interface (siyuan-note#15627)
  🎨 https://ld246.com/article/1760404351939
  🐛 siyuan-note#15998
  🎨 Clean code
  🎨 siyuan-note#15998
  🎨 siyuan-note#15989 30
  🎨 Improve fold heading editing siyuan-note#15989
  🎨 siyuan-note#15989 28&29
  🎨 Improve fold heading editing siyuan-note#15989
  🎨 Improve fold heading editing siyuan-note#15989
  🎨 Improve fold heading editing siyuan-note#15989
  🧑‍💻 siyuan-note#16083
  ⬆️ Upgrade lute
  ⬆️ Upgrade lute
  🎨 siyuan-note#16024
  🎨 siyuan-note#16011
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants